package MetaClassifierAlgorithms;

import java.io.Serializable;

import Global.ConstantVariable;
import Utility.WorkerUtilityClass;

public class MetaClassifierExecutionDataClass implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -7157596421370059439L;
	//Fold no-Number of Cls-Number of nodes-Pr Dist.
	private double[][][][] probabilityDistributionMatrixForTheClassifiersForAllFolds ;
	private boolean isLoadedFromBackup;
	private String similarityMeasure;
	
	private String coClsForMetaCls;
	private String loClsForMetaCls;
	
	private String secLevelCoClsForMetaCls;
	private String secLevelLoClsForMetaCls;
	
	private String coClsForAlphaCalc;
	private String loClsForAlphaCalc;
	
	private String secLevelCoClsForAlphaCalc;
	private String secLevelLoClsForAlphaCalc;
	
	
	public boolean isLoaded() {
		return isLoadedFromBackup;
	}

	public void setLoaded(boolean isLoadedFromBackup) {
		this.isLoadedFromBackup = isLoadedFromBackup;
		
	}

	MetaClassifierExecutionDataClass()
	{
		isLoadedFromBackup = false;
		probabilityDistributionMatrixForTheClassifiersForAllFolds = null;
		similarityMeasure = ConstantVariable.SimilarityCalculator_ConstantVariables.DEFAULT_SIMILARITY_MEASURE;
		
		coClsForMetaCls = ConstantVariable.ExecutionParameters.SELECTED_LOCAL_CLASSIFIER_FOR_MERGE_CALCULATION_CONTENT; 
		loClsForMetaCls = ConstantVariable.ExecutionParameters.SELECTED_LOCAL_CLASSIFIER_FOR_MERGE_CALCULATION_LINK;
		
		secLevelCoClsForMetaCls = ConstantVariable.ExecutionParameters.SELECTED_SECOND_LEVEL_LOCAL_CLASSIFIER_FOR_MERGE_CALCULATION_CONTENT; 
		secLevelLoClsForMetaCls = ConstantVariable.ExecutionParameters.SELECTED_SECOND_LEVEL_LOCAL_CLASSIFIER_FOR_MERGE_CALCULATION_LINK;
		
		coClsForAlphaCalc = ConstantVariable.ExecutionParameters.SELECTED_LOCAL_CLASSIFIER_FOR_ALPHA_CALCULATION_CONTENT; 
		loClsForAlphaCalc = ConstantVariable.ExecutionParameters.SELECTED_LOCAL_CLASSIFIER_FOR_ALPHA_CALCULATION_LINK;
		
		secLevelCoClsForAlphaCalc = ConstantVariable.ExecutionParameters.SELECTED_SECOND_LEVEL_LOCAL_CLASSIFIER_FOR_ALPHA_CALCULATION_CONTENT; 
		secLevelLoClsForAlphaCalc = ConstantVariable.ExecutionParameters.SELECTED_SECOND_LEVEL_LOCAL_CLASSIFIER_FOR_ALPHA_CALCULATION_LINK;		
	}	
	
	void setProbabilityDistributionMatrixForTheClassifiersForTheFold(double[][][] probabilityDistributionMatrixForTheClassifiersForTheFold, int foldNo)
	{
		WorkerUtilityClass.copyThreeDimensionalArray(probabilityDistributionMatrixForTheClassifiersForTheFold, probabilityDistributionMatrixForTheClassifiersForAllFolds[foldNo]);
	}
	
	double[][][] getProbabilityDistributionMatrixForTheClassifiersForTheFold(int foldNo)
	{		
		return probabilityDistributionMatrixForTheClassifiersForAllFolds[foldNo];		
	}
	
	public synchronized void createMetaExecutionResultsMatrix(int numberOfFolds, int numberOfClassifiers, int numberOfNodesInThisList, int numberOfClasses)
	{
		if(probabilityDistributionMatrixForTheClassifiersForAllFolds == null)
			probabilityDistributionMatrixForTheClassifiersForAllFolds = new double[numberOfFolds][numberOfClassifiers][numberOfNodesInThisList][numberOfClasses];
		
	}
	
	public boolean checkIfAnyImportantParametersChangedComparedToPreviousExecution(MetaClassifierExecutionDataClass newOne)
	{
	/*
		if(newOne.coClsForMetaCls.equals(coClsForMetaCls) &&
				newOne.loClsForMetaCls.equals(loClsForMetaCls) &&
				newOne.coClsForAlphaCalc.equals(coClsForAlphaCalc) &&
				newOne.loClsForAlphaCalc.equals(loClsForAlphaCalc) &&
				newOne.secLevelCoClsForMetaCls.equals(secLevelCoClsForMetaCls) &&
				newOne.secLevelLoClsForMetaCls.equals(secLevelLoClsForMetaCls) &&
				newOne.secLevelCoClsForAlphaCalc.equals(secLevelCoClsForAlphaCalc) &&
				newOne.secLevelLoClsForAlphaCalc.equals(secLevelLoClsForAlphaCalc))
			return true;*/

		return false;	
	}
}
